package cn.weiyang.action;

import cn.weiyang.biz.HouseBiz;
import cn.weiyang.biz.HouseBizImpl;
import cn.weiyang.entity.House;
import cn.weiyang.entity.HousePage;
import com.google.gson.Gson;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2017/7/8.
 */
public class HouseAction extends BaseAction{
    /*搜索标题*/
    private String titleLike;
    /*最低价格*/
    private int lowPrice;
    /*最高价格*/
    private int highPrice;
    /*最小面积*/
    private int lowFloorage;
    /*最大面积*/
    private int highFloorage;
    /*区县名*/
    private int did;
    /*街道名*/
    private int sid;
    /*房屋类型*/
    private int tid;
    /*每页记录数*/
    private int pageSize;
    /*当前页*/
    private int pageNum;
    public String queryHouse() throws IOException {
        HouseBiz hb=new HouseBizImpl();
        Map map=new HashMap();
        map.put("titleLike",titleLike);
        map.put("did",did);
        map.put("sid",sid);
        map.put("tid",tid);
        map.put("lowPrice",lowPrice);
        map.put("highPrice",highPrice);
        map.put("lowFloorage",lowFloorage);
        map.put("highFloorage",highFloorage);
        map.put("pageSize",pageSize);
        map.put("pageNum",pageNum);
        /*map.put("floorageCondition",floorageCondition);*/
        HousePage housePage=hb.queryHouse(map);
        Gson gson = new Gson();
        //在这里转化成json
        String json =gson.toJson(housePage);
        getResponse().setContentType("application/json;charset=UTF-8");
        getResponse().getWriter().println(json);
        return null;
    }

    public String getTitleLike() {
        return titleLike;
    }

    public void setTitleLike(String titleLike) {
        this.titleLike = titleLike;
    }

    public int getDid() {
        return did;
    }

    public void setDid(int did) {
        this.did = did;
    }

    public int getSid() {
        return sid;
    }

    public void setSid(int sid) {
        this.sid = sid;
    }

    public int getTid() {
        return tid;
    }

    public void setTid(int tid) {
        this.tid = tid;
    }

    public int getLowPrice() {
        return lowPrice;
    }

    public void setLowPrice(int lowPrice) {
        this.lowPrice = lowPrice;
    }

    public int getHighPrice() {
        return highPrice;
    }

    public void setHighPrice(int highPrice) {
        this.highPrice = highPrice;
    }

    public int getLowFloorage() {
        return lowFloorage;
    }

    public void setLowFloorage(int lowFloorage) {
        this.lowFloorage = lowFloorage;
    }

    public int getHighFloorage() {
        return highFloorage;
    }

    public void setHighFloorage(int highFloorage) {
        this.highFloorage = highFloorage;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }
}
